<template>
  <view class="body">
    <view class="list" v-for="item in list" :key="item.id">
      <view
        class="list_content"
        @click="toDetail(item)"
      >
        <view class="list_time">
          <text
            >{{ getMinutes(item.confirm_time * 1000) }}&nbsp;&nbsp;送达</text
          >
        </view>
        <view class="list_title">
          <view
            style="
              width: 10rpx;
              height: 10rpx;
              background: #fe5f0f;
              border-radius: 50%;
              margin-right: 10rpx;
            "
          ></view>
          <view class="title">
            <text>{{ item.store_name }}</text>
            <text style="margin-left: 30rpx"
              >#{{ item.order_no.slice(-4) }}</text
            >
          </view>
        </view>
        <view class="list_title">
          <view
            style="
              width: 10rpx;
              height: 10rpx;
              background: #01ab5b;
              border-radius: 50%;
              margin-right: 10rpx;
            "
          ></view>
          <view class="title">{{ item.address }}</view>
        </view>
        <view class="order">订单编号:{{ item.order_no }}</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      list: [],
    };
  },
  onLoad() {
    this.getList();
  },
  methods: {
    async getList() {
      const res = await this.$allrequest.distribution.getOrderList(
        { status: 4 },
        true
      );
      if (res.code == 0) {
        this.list = res.data.data;
        //  this.statusList=res.data.data
      }
    },
    toDetail(i){
      this.$utils.toUrl(`/distribution/order/order_detail?i=`+encodeURIComponent(JSON.stringify(i)), "navigate")
    },
    getMinutes(val) {
      var date = new Date(val);
      let hour = date.getHours(); // 获取小时
      let minute = date.getMinutes(); // 获取分钟

      if (hour >= 1 && hour <= 9) {
        hour = "0" + hour;
      }
      if (minute >= 0 && minute <= 9) {
        minute = "0" + minute;
      }
      return hour + ":" + minute;
    },
  },
};
</script>

<style lang="scss" scoped>
.body {
  min-height: 100vh;
  background: #f8f8f8;
  padding: 24rpx 0;
  .list {
    .list_content {
      width: 702rpx;
      height: 244rpx;
      background: #ffffff;
      border-radius: 20rpx 20rpx 20rpx 20rpx;
      margin: 0 auto;
      margin-bottom: 24rpx;
      padding: 24rpx;

      .list_time {
        font-size: 24rpx;
        font-family: PingFang SC-Regular, PingFang SC;
        font-weight: 400;
        color: #262626;
        margin-bottom: 20rpx;
      }
      .list_title {
        display: flex;
        align-items: center;
        margin-bottom: 16rpx;
        .title {
          font-size: 24rpx;
          font-family: PingFang SC-Regular, PingFang SC;
          font-weight: 400;
          color: #262626;
        }
      }
    }
  }
  .order {
    font-size: 24rpx;
    font-family: PingFang SC-Regular, PingFang SC;
    font-weight: 400;
    color: #8c8c8c;
    margin-top: 20rpx;
  }
}
</style>
